import { RouteRecordRaw } from "vue-router";
export const importComponent = (filePath: string) => () => import(`@/views/${filePath}/index.vue`);
export const returnPath = (router: Array<RouteRecordRaw>) => {
  const item: any = router[0] || {}
  if (item.children && item.children.length) {
    return `/${item.path}/${item.children[0].path}`
  }
  return `/${item.path}`
}
export const returnFirstRouterPath = (router: Array<RouteRecordRaw>) => {
  let redirectPath = "";
  if (router.length) {
    redirectPath = returnPath(router.filter((item, index) => index === 0))
  }
  return redirectPath
}
